Skip to content

mapbox/mapbox-gl-geocoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

66c236f · Sep 13, 2024
Feb 13, 2023
Jan 25, 2022
Dec 15, 2023
Sep 13, 2024
Sep 13, 2024
May 17, 2019
Jul 13, 2018
Dec 15, 2023
Sep 13, 2024
Sep 13, 2024
Dec 15, 2023
Jul 3, 2018
Mar 30, 2021
Jan 23, 2022
Sep 13, 2024
Sep 13, 2024

Repository files navigation

Mapbox GL Geocoder Build Status

A geocoder control for mapbox-gl-js using the Mapbox Geocoding API. For a JavaScript geocoder without a graphical user interface see the Mapbox SDK for JS.

Usage

If you are supporting older browsers, you will need to use a polyfill. We recommend working with @babel/polyfill.

Usage with a module bundler

npm install --save @mapbox/mapbox-gl-geocoder
import MapboxGeocoder from '@mapbox/mapbox-gl-geocoder';
import '@mapbox/mapbox-gl-geocoder/dist/mapbox-gl-geocoder.css';
...
const geocoder = new MapboxGeocoder({
    accessToken: mapboxgl.accessToken,
    mapboxgl: mapboxgl
});

Using without a Map

It is possible to use the plugin without it being placed as a control on a mapbox-gl map. Keep in mind that the Mapbox Terms of Service require that POI search results be shown on a Mapbox map. If you don't need POIs, you can exclude them from your search results with the options.types parameter when constructing a new Geocoder.

Deeper dive

API Documentation

See API.md for complete reference.

Examples

See https://docs.mapbox.com/mapbox-gl-js/examples/#geocoder.

Contributing

See CONTRIBUTING.md.